package com.servlet;

import com.entity.Students;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/LikeStuServlet")
public class LikeStuServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        LikeStu likeStu = new LikeStu();
        List<Students> stuList =likeStu.getlist(request.getParameter("Sname"));
        //设置一个新的请求参数
        request.setAttribute("stuList",stuList);
        //携带请求转发
        request.getRequestDispatcher("/search.jsp").forward(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
